<?php 
//引入头部和常用函数
include_once '../function.php';

try{
	$db = new PDO("mysql:host=127.0.0.1;dbname=school;charset=utf8","root","");
	
}catch(PDOException  $e ){
	echo "Error: ".$e;exit;
}

$sql = "select * from stu limit 20";

$sql = "update stu set sex='男' where id ='12'";

$res = $db->query($sql);

if(!$res){
	echo "执行失败：错误代码：".$db->errorCode()."错误信息：".$db->errorInfo()[2];
}

var_dump($res);

// $userlist = $res->fetchAll(PDO::FETCH_OBJ);

// var_dump($userlist);
// 











?>